package com.itmuch.usercenter.demos.web;

import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.spring.annotation.MapperScan;
import com.itmuch.usercenter.dao.user.UserMapper;
import com.itmuch.usercenter.domain.entity.user.User;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * ClassName: TestController
 * Package: com.itmuch.usercenter.demos.web
 * description:
 *
 * @Author 甄欣凡
 * @create: 2023-12-22 23:30
 */
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Lazy))
public class TestController {

    private  final  UserMapper userMapper;
    @GetMapping("test")
    public User testInsert(){
        User user = User.builder()
                .avatarUrl("xxx")
                .bonus(100)
                .createTime(new Date())
                .build();
        //表示insert into （1，2，3） values（）。。。普通insert就没有（1，2，3）
          userMapper.insertSelective(user);
          return user;

    }
}
